package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: twer
 * Date: 5/24/13
 * Time: 12:44 PM
 * To change this template use File | Settings | File Templates.
 */
public class Movie {
    private String name;
    private String year;
    private String director;
    private String rating = "N/A";

    public Movie(String name, String year, String director) {
        this.name = name;
        this.year = year;
        this.director = director;
    }

    public void setRating(String rating) {
        this.rating = rating;
    }

    public String getDirector() {
        return director;
    }

    public String getYear() {
        return year;
    }

    public String getName() {
        return name;
    }

    public String getRating() {
        return rating;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Movie movie = (Movie) o;

        if (!director.equals(movie.director)) return false;
        if (!name.equals(movie.name)) return false;
        if (!year.equals(movie.year)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + year.hashCode();
        result = 31 * result + director.hashCode();
        return result;
    }
}
